#!/usr/bin/env bash
#hack to add some paths

    # get current path
    if test $(echo $0 | grep "Wine.bundle/Contents/bin/wine"); then
        WINE_DIRNAME="$(dirname "$0")"
    else
        WINE_DIRNAME="$PWD"
    fi

    # $PATH, $LD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, FONTCONFIG_FILE
    export PATH="$WINE_DIRNAME/../bin":$PATH
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$WINE_DIRNAME/../lib":"/usr/X11R6/lib"
    export DYLD_FALLBACK_LIBRARY_PATH="$WINE_DIRNAME/../lib"
    export FONTCONFIG_FILE="$WINE_DIRNAME/../etc/fonts/fonts.conf"

    if test $(echo $OSTYPE | grep darwin8); then
        # set Display properties for Tiger
        export DISPLAY=:0.0
        open /Applications/Utilities/X11.app
    fi

    # start wine
    exec "$WINE_DIRNAME/mwine" "$@"